package transaction.xml;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("bookShopService")
public class BookShopServiceImpl implements BookShopService{

	@Autowired
	private BookShopDao bookShopDao;
	
	@Override
	public void purchase(int userId, int bookId) {
		int price = bookShopDao.getBookPriceById(bookId);
		bookShopDao.updateBookStock(bookId);
		bookShopDao.updateUserAccount(userId, price);
	}
}
